<script>
export default {
  name: "my-ListAdmin",
};
</script>

<script setup>
import { reactive, ref } from "vue";
import { useRouter } from "vue-router";
import { getAdminListApi } from "../../api/admin";
const router = useRouter();
const form = reactive({
  name: "",
});
const tableData = ref([]);

getAdminListApi({page: 1,count: 1000}).then(res => {
  console.log(res);
})

//新增的点击事件
function addAction() {
  router.push({ name: "addAdmin" });
}
</script>

<template>
  <el-form inline class="form">
    <el-form-item label="名称">
      <el-input v-model="form.name" size="small" placeholder="请输入" />
    </el-form-item>
    <el-form-item label="角色">
      <el-select  placeholder="请选择" size="small">
        <el-option label="Zone one" value="shanghai" />
        <el-option label="Zone two" value="beijing" />
      </el-select>
    </el-form-item>
    <div>
      <el-button type="primary">查看</el-button>
      <el-button>重置</el-button>
    </div>
  </el-form>
  <el-button @click="addAction">新增</el-button>
  <el-button type="info" plain>批量删除</el-button>
  <!-- 管理员列表 -->
  <el-table
    border
    ref="multipleTableRef"
    :data="tableData"
    style="width: 100%"
    @selection-change="handleSelectionChange"
    class="table"
  >
    <el-table-column type="selection" width="55" />
    <el-table-column label="用户名称" property="data" width="300">
      <template #default="scope">{{ scope.row.date }}</template>
    </el-table-column>
    <el-table-column property="name" label="角色" width="300" />
    <el-table-column property="address" label="创建日期" width="250" />
    <el-table-column property="address" label="操作">
      <template #default="scope">
        <el-button size="small">编辑</el-button>
        <el-button size="small" type="danger">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
  <!-- 分页器 -->
  <div class="demo-pagination-block">
    <el-pagination
      background
      v-model:current-page="currentPage4"
      v-model:page-size="pageSize4"
      :page-sizes="[100, 200, 300, 400]"
      :small="small"
      :disabled="disabled"
      :background="background"
      layout="total, sizes, prev, pager, next, jumper"
      :total="400"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<style scoped lang="scss">
.form {
  display: flex;
}
.table {
  margin-top: 30px;
  margin-bottom: 20px;
}
.demo-pagination-block + .demo-pagination-block {
  margin-top: 10px;
}
.demo-pagination-block .demonstration {
  margin-bottom: 16px;
}
</style>